home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: artemis.sto.fdata.se!news
- From: Niklas Mellin <niklas.mellin@sto.fdata.se>
- Subject: Re: How to change the following BASIC into C++?
- Sender: news@artemis.sto.fdata.se (UseNet NetNews)
- Message-ID: <30ECFE8F.541B@sto.fdata.se>
- Date: Fri, 5 Jan 1996 10:33:51 GMT
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
- References: <4ciit7$6fa@news.ust.hk>
- Mime-Version: 1.0
- X-Mailer: Mozilla 2.0b4 (WinNT; I)
- Organization: WM-data F÷rsvarsdata AB, Sweden
-
- Wong Siu Ki wrote:
- >
- > Hi!
- > I want to know how to write the following things in C++:
- >
- > 10 a$=inkey$
- > 20 print "ok"
- > 30 if a$="" then goto 10
- >
-
- Here is one way of doing it. kbhit() returns non-zero if the
- user has pressed any key.
-
- #include <conio.h> // declaration of kbhit()
- #include <iostream.h> // declaration of cout
-
- int main(int, char* [])
- {
- while (!kbhit())
- {
- // Here is a good place to put a delay
- cout << "Ok ";
- }
- return 0;
- }
-